package task2_2.com.at.count;

import task2_2.com.at.count.polsk.CounterException;

public class Parameter {
    private String name;
    private double value;

    public Parameter(String name) throws CounterException {
        this.name = checkParamName(name);
    }

    public String getName() {
        return name;
    }

    public void setValue(double value) {
        this.value = value;
    }

    public double getValue() {
        return value;
    }

    private String checkParamName(String name) throws CounterException{
        name = name.trim();
        if (name.length() > 0 && name.matches("[a-zA-Z][[a-zA-Z][0-9]]*?")) {
            return name;
        }
        throw new CounterException();
    }

}
